home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / dflat8.zip / SYSTEM.H < prev    next >
Text File  |  1991-09-26  |  5KB  |  172 lines

  1. /* --------------- system.h -------------- */
  2. #ifndef SYSTEM_H
  3. #define SYSTEM_H
  4.  
  5. #if MSC | WATCOM
  6. #include <direct.h>
  7. #else
  8. #include <dir.h>
  9. #endif
  10.  
  11. #define swap(a,b){int x=a;a=b;b=x;}
  12. /* ----- interrupt vectors ----- */
  13. #define TIMER  8
  14. #define VIDEO  0x10
  15. #define KEYBRD 0x16
  16. #define DOS    0x21
  17. #define CRIT   0x24
  18. #define MOUSE  0x33
  19. #define KEYBOARDVECT 9
  20. /* ------- platform-dependent values ------ */
  21. #define KEYBOARDPORT 0x60
  22. #define FREQUENCY 100
  23. #define COUNT (1193280L / FREQUENCY)
  24. #define ZEROFLAG 0x40
  25. #define MAXSAVES 50
  26. #define SCREENWIDTH  (peekb(0x40,0x4a) & 255)
  27. #define SCREENHEIGHT (isVGA() || isEGA() ? peekb(0x40,0x84)+1 : 25)
  28. #define clearBIOSbuffer() *(int far *)(MK_FP(0x40,0x1a)) = \
  29.                           *(int far *)(MK_FP(0x40,0x1c));
  30. #define waitforkeyboard() while ((keyportvalue & 0x80) == 0) \
  31.                           clearBIOSbuffer()
  32. /* ----- keyboard BIOS (0x16) functions -------- */
  33. #define READKB 0
  34. #define KBSTAT 1
  35. /* ------- video BIOS (0x10) functions --------- */
  36. #define SETCURSORTYPE 1
  37. #define SETCURSOR     2
  38. #define READCURSOR    3
  39. #define READATTRCHAR  8
  40. #define WRITEATTRCHAR 9
  41. #define HIDECURSOR 0x20
  42. /* ------- the interrupt function registers -------- */
  43. typedef struct {
  44.     int bp,di,si,ds,es,dx,cx,bx,ax,ip,cs,fl;
  45. } IREGS;
  46. /* ---------- keyboard prototypes -------- */
  47. int AltConvert(int);
  48. int getkey(void);
  49. int getshift(void);
  50. int keyhit(void);
  51. void beep(void);
  52. /* ---------- cursor prototypes -------- */
  53. void curr_cursor(int *x, int *y);
  54. void cursor(int x, int y);
  55. void hidecursor(void);
  56. void unhidecursor(void);
  57. void savecursor(void);
  58. void restorecursor(void);
  59. void normalcursor(void);
  60. void set_cursor_type(unsigned t);
  61. void videomode(void);
  62. void SwapCursorStack(void);
  63. /* ---------- mouse prototypes ---------- */
  64. int mouse_installed(void);
  65. int mousebuttons(void);
  66. void get_mouseposition(int *x, int *y);
  67. void set_mouseposition(int x, int y);
  68. void show_mousecursor(void);
  69. void hide_mousecursor(void);
  70. int button_releases(void);
  71. void resetmouse(void);
  72. void set_mousetravel(int, int, int, int);
  73. #define leftbutton()     (mousebuttons()&1)
  74. #define rightbutton()     (mousebuttons()&2)
  75. #define waitformouse()     while(mousebuttons());
  76. /* ------------ timer macros -------------- */
  77. #define timed_out(timer)         (timer==0)
  78. #define set_timer(timer, secs)     timer=(secs)*182/10+1
  79. #define disable_timer(timer)     timer = -1
  80. #define timer_running(timer)     (timer > 0)
  81. #define countdown(timer)         --timer
  82. #define timer_disabled(timer)     (timer == -1)
  83. /* ----------- video adaptor prototypes ----------- */
  84. void initvideo(void);
  85. void restorevideo(void);
  86. int isEGA(void);
  87. int isVGA(void);
  88. void Set25(void);
  89. void Set43(void);
  90. void Set50(void);
  91.  
  92. #ifndef TURBOC
  93. #ifndef BCCP
  94. /* ============= Color Macros ============ */
  95. #define BLACK         0
  96. #define BLUE          1
  97. #define GREEN         2
  98. #define CYAN          3
  99. #define RED           4
  100. #define MAGENTA       5
  101. #define BROWN         6
  102. #define LIGHTGRAY     7
  103. #define DARKGRAY      8
  104. #define LIGHTBLUE     9
  105. #define LIGHTGREEN   10
  106. #define LIGHTCYAN    11
  107. #define LIGHTRED     12
  108. #define LIGHTMAGENTA 13
  109. #define YELLOW       14
  110. #define WHITE        15
  111. #define keyhit       kbhit
  112. #endif
  113. #endif
  114.  
  115. #if MSC | WATCOM
  116. /* ============= Compatibility Macros ============ */
  117. #undef FP_OFF
  118. #undef FP_SEG
  119. #undef MK_FP
  120. #define FP_OFF(p)    ((unsigned)(p))
  121. #define FP_SEG(p)    ((unsigned)((unsigned long)(p) >> 16))
  122. #define MK_FP(s,o)   ((void far *) \
  123.                (((unsigned long)(s) << 16) | (unsigned)(o)))
  124. #define findfirst(p,f,a) _dos_findfirst(p,a,f)
  125. #define findnext(f)      _dos_findnext(f)
  126. #define ffblk            find_t
  127. #define ff_name          name
  128. #define ff_fsize         size
  129. #define ff_attrib        attrib
  130. #define poke(a,b,c)  (*((int  far*)MK_FP((a),(b))) = (int)(c))
  131. #define pokeb(a,b,c) (*((char far*)MK_FP((a),(b))) = (char)(c))
  132. #define peek(a,b)    (*((int  far*)MK_FP((a),(b))))
  133. #define peekb(a,b)   (*((char far*)MK_FP((a),(b))))
  134. #define getvect(v)   _dos_getvect(v)
  135. #define setvect(v,f) _dos_setvect(v,f)
  136. #define fnsplit          _splitpath
  137. #define fnmerge          _makepath
  138. #define EXTENSION         2
  139. #define FILENAME          4
  140. #define DIRECTORY         8
  141. #define DRIVE            16
  142. int getdisk(void);
  143. #define setdisk(d)       _dos_setdrive((d)+1, NULL)
  144. #define bioskey          _bios_keybrd
  145. #define MAXPATH          80
  146. #define MAXDRIVE          3
  147. #define MAXDIR           66
  148. #define MAXFILE           9
  149. #define MAXEXT            5
  150. #endif
  151.  
  152. typedef enum messages {
  153. #ifdef WATCOM
  154.     WATCOMFIX1 = -1,
  155. #endif
  156.     #undef DFlatMsg
  157.     #define DFlatMsg(m) m,
  158.     #include "dflatmsg.h"
  159.     MESSAGECOUNT
  160. } MESSAGE;
  161.  
  162. typedef enum window_class    {
  163. #ifdef WATCOM
  164.     WATCOMFIX2 = -1,
  165. #endif
  166.     #define ClassDef(c,b,p,a) c,
  167.     #include "classes.h"
  168.     CLASSCOUNT
  169. } CLASS;
  170.  
  171. #endif
  172.